﻿using B.S.Sterilizationcenter.Domain.zmc;
using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Read.API.Appliaction.Commends.zmc.Warehou;
using B.S.Sterilizationcenter.Read.API.Dto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Sterilizationcenter.Read.API.Controllers.ZMC
{

    /// <summary>
    /// 入库信息
    /// </summary>
    [Route("api/[controller]/[Action]")]
    [ApiController]
    public class WarehouController : ControllerBase
    {
        private readonly IMediator mediator;

        public WarehouController(IMediator mediator)
        {
            this.mediator = mediator;
        }


        /// <summary>
        /// 查询入库信息
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="cancellationToken">返回</param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<ApiResult<List<Warehous>>> QueryWarehous([FromQuery]WarehousidentifyCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 查询仓入库详情记录信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<ApiResult<List<warehousStuDto>>> QueryWarehousdetailsrecordStuff([FromQuery]QueryWarehousdetailsrecordStuffCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);

            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 根据入库编号获取入库信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<ApiResult<List<warehousStuDto>>> QueryWarehousStuffWareNo([FromQuery]QueryWarehousStuffWareNoCommends request, CancellationToken cancellationToken)
        {
            try
            {
                 return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 获取清洗入库物料信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<ApiResult<List<CleaningorderWareStuffDto>>> CleaningorderWareStuff([FromQuery]CleaningorderWareStuffCommends request, CancellationToken cancellationToken)
        {
            try
            {

                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 获取清洗记录
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<ApiResult<List<CleaningorderWarehousDto>>> Cleaningrecords([FromQuery]CleaningrecordsCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 根据条码查询物品
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<ApiResult<List<StuffCleaningStuffRelationDto>>> QueryStuffstuffbarcode([FromQuery]QueryStuffstuffbarcodeCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
